package com.huawei.appmarket.service.usercenter.personal.view.fragment;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import com.huawei.appgallery.foundation.account.bean.UserSession;
import com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.BaseListFragment;
import com.huawei.secure.android.common.intent.SafeBroadcastReceiver;
import o.cdb;
import o.che;
import o.cia;
import o.der.f;
import o.der.g;
import o.der.i;
import o.dgm;
import o.dmi;
import o.dmq;
import o.Logger;
import o.eby;
import o.eke;
import o.ekg;
import o.ekp;
import o.ekr;
import o.eks;
import o.elx;
import o.elz;
import o.emb;
import o.emb.a;
import o.eod;
import o.eoi;
import o.eoj;
import o.ll;

public class BasePersonalFragment extends BaseListFragment implements elx, elz {
    private final BroadcastReceiver ˋ = new d();
    private eks ˎ = new eks();
    private int ॱ = 0;

    class b implements dmi {
        final /* synthetic */ BasePersonalFragment ˎ;
        private boolean ˏ;

        public b(BasePersonalFragment basePersonalFragment, boolean z) {
            this.ˎ = basePersonalFragment;
            this.ˏ = z;
        }

        public void run() {
            this.ˎ.ˏॱ(this.ˏ);
            this.ˎ.ˑॱ();
        }
    }

    class d extends SafeBroadcastReceiver {
        final /* synthetic */ BasePersonalFragment ॱ;

        private d(BasePersonalFragment basePersonalFragment) {
            this.ॱ = basePersonalFragment;
        }

        public void onReceiveMsg(Context context, Intent intent) {
            if (this.ॱ.ͺˏ()) {
                String action = intent.getAction();
                Logger.ˎ(this.ॱ.ˉॱ(), "ChangeBroadcastReceiver action= " + action);
                if (this.ॱ.ˊ(action)) {
                    this.ॱ.ˑॱ();
                    return;
                }
                return;
            }
            Logger.ˋ(this.ॱ.ˉॱ(), "isAlive false");
        }
    }

    protected String ˊʻ() {
        return ˉॱ();
    }

    protected String ˉॱ() {
        return "BasePersonalFragment";
    }

    protected int ˊʽ() {
        return i.ˋ;
    }

    protected a ˋʽ() {
        return a.APPGALLERY;
    }

    protected emb ˋʻ() {
        emb o_emb = new emb(dgm.ˎ(ॱˋ()), ˋʽ());
        o_emb.ˊ(this);
        return o_emb;
    }

    protected void ͺˎ() {
        this.ͺˎ.setPadding(0, this.ॱ, 0, 0);
    }

    protected void ˏͺ() {
        this.ʽˊ = ᐝॱ().getString(f.ॱͺ);
    }

    public cia ˊ(Context context) {
        cia ˎ = che.ˎ().ˎ(context, ˊʽ());
        ˎ.ˊ(false);
        return ˎ;
    }

    public void ˏ(Bundle bundle) {
        ॱˋ(true);
        ٴ();
        super.ˏ(bundle);
        י();
        ˏͺ();
        ॱـ();
        ՙ();
        ॱʾ();
    }

    public View ˋ(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        ((eke) cdb.ॱ(eke.class)).ˎ(ॱˋ(), false);
        View ˋ = super.ˋ(layoutInflater, viewGroup, bundle);
        ˋॱ(true);
        ͺˎ();
        return ˋ;
    }

    public void ᵔ() {
        ˎ(this.ॱˍ);
    }

    public int ߵ() {
        return g.ʽ;
    }

    public void ˌ() {
        super.ˌ();
        ـॱ();
    }

    public void ˎˎ() {
        ॱˑ();
        ߺ();
        ॱˉ();
        ((eke) cdb.ॱ(eke.class)).ˋ();
        ॱˌ();
        super.ˎˎ();
    }

    public void ˑॱ() {
        if (this.י != null && ॱˋ() != null && !ॱˋ().isFinishing()) {
            if (Logger.ˎ()) {
                Logger.ˏ("BasePersonalFragment", "start refresh personal");
            }
            this.י.ͺ();
        }
    }

    private boolean ˊ(String str) {
        return o.epx.d.ˎ.equals(str) || e.ˎ.equals(str) || "com.huawei.appmarket.service.broadcast.AgeAbtained".equals(str);
    }

    public boolean ͺˏ() {
        return (ॱˋ() == null || ॱˋ().isFinishing()) ? false : true;
    }

    private void ٴ() {
        ekg.ॱ().ˊ(dgm.ˎ(ॱˋ()));
    }

    private void י() {
        this.ॱ = 0;
    }

    private void ـॱ() {
        if (UserSession.getInstance().isLoginSuccessful()) {
            eod.ˏ(ॱˋ(), new eoi(this) {
                final /* synthetic */ BasePersonalFragment ˏ;

                {
                    this.ˏ = r1;
                }

                public void ˎ(int i) {
                    if (i == 1) {
                        this.ˏ.ˎ.ˋ(dgm.ˎ(this.ˏ.ॱˋ()));
                        this.ˏ.ˎ.ˊ(this.ˏ.ॱˋ());
                        return;
                    }
                    eod.ˏ(this.ˏ.ॱˋ());
                }
            }, true);
        }
        ˑॱ();
    }

    private void ՙ() {
        eoj.ˋ().ˎ(ˊʻ(), ˋʻ());
    }

    private void ॱʾ() {
        eby.ˎ().ˎ(ˊʻ(), this);
    }

    private void ߺ() {
        eoj.ˋ().ˊ(ˊʻ());
    }

    private void ॱˉ() {
        eby.ˎ().ˊ(ˊʻ());
    }

    private void ॱـ() {
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(o.epx.d.ˎ);
        intentFilter.addAction(e.ˎ);
        intentFilter.addAction("com.huawei.appmarket.service.broadcast.AgeAbtained");
        ll.ˏ(ॱˋ()).ˏ(this.ˋ, intentFilter);
    }

    private void ॱˑ() {
        ll.ˏ(ॱˋ()).ˋ(this.ˋ);
    }

    private void ॱˌ() {
        if (this.ˎ != null) {
            this.ˎ.ˏ();
        }
    }

    public void ॱˊ(boolean z) {
        Logger.ˎ(ˉॱ(), "has OTA update version had=" + z);
        dmq.ॱ.ˊ(new b(this, z));
    }

    private void ˏॱ(boolean z) {
        if (z) {
            ekg.ॱ().ˊ(true);
            ekr.ॱ(ekp.ˏ, ekr.ˋ);
            return;
        }
        ekg.ॱ().ˊ(false);
        ekr.ॱ(ekp.ˏ, ekr.ˎ);
    }

    public void onScrollStateChanged(AbsListView absListView, int i) {
        super.onScrollStateChanged(absListView, i);
    }

    public void ˋᐝ() {
        super.ˋᐝ();
    }
}
